<?php

namespace App\Admin\Actions\Batch;

use Encore\Admin\Actions\BatchAction;
use Encore\Admin\Actions\Response;
use Illuminate\Database\Eloquent\Collection;

class BatchCustomerDelete extends BatchAction
{
    public $name = '批量删除';

    public function handle(Collection $collection): Response
    {
        foreach ($collection as $model) {
            $model->delete();
        }
        return $this->response()->success('操作成功')->refresh();
    }

    /**
     * dialog
     * @return void
     */
    public function dialog(): void
    {
        $this->confirm('确定删除?');
    }
}
